<template>
  <div>
    <el-date-picker
        v-model="date"
        type="daterange"
        range-separator="To"
        start-placeholder="Start date"
        end-placeholder="End date"
        size="large"
        @change="changeDateTime"
      />
  </div>
</template>

<script lang='ts' setup>
import dayjs from 'dayjs';
import {  ref,onMounted } from 'vue'
const date = ref<string[]>([])
// 改变v-model绑定的时间
const changeDateTime = (value:any) => {
    const start = dayjs(value[0]).format('YYYY-MM-DD 00:00:00')
    const end = dayjs(value[1]).add(1,'day').format(`YYYY-MM-DD 00:00:00`)
    console.log(start,end,'22');
}
onMounted(() => {
    date.value = [dayjs().subtract(6,'day').format(`YYYY-MM-DD 00:00:00`),dayjs().add(1,'day').format(`YYYY-MM-DD 00:00:00`)]
})
</script>
<style lang="scss" scoped>
</style>